<?php

namespace C\R;

use C\L\Resource;

class Payment extends Resource
{
    public function toArray()
    {
        $otherInfo = json_decode($this->model->other_info, true);

        return [
        'id'                => $this->model->id,
        'name'              => $this->model->name,
        'amount_options'    => $otherInfo['amount_options'] ?? [],

        'is_enabled_alipay' => $this->model->is_enabled_alipay,
        'alipay_qrcode'     => $this->model->alipay_qrcode,
        'alipay_note'       => $this->model->alipay_note,

        'is_enabled_wechat' => $this->model->is_enabled_wechat,
        'wechat_qrcode'     => $this->model->wechat_qrcode,
        'wechat_note'       => $this->model->wechat_note,

        'is_enabled_bank'   => $this->model->is_enabled_bank,
        'bank_note'         => $this->model->bank_note,
        'bank_name'         => $this->model->bank_name,
        'bank_card_name'    => $this->model->bank_card_name,
        'bank_card_no'      => $this->model->bank_card_no,

        'updated_at'        => $this->model->updated_at,
        'created_at'        => $this->model->created_at,
        ];
    }
}
